package createThread.cn.tedu.threaddemo;

class Method_Thread1 extends Thread{
    /**
     * 1.继承Thread类并重写run方法
     */
    @Override
    public void run() {
        for (int i = 0; i < 10000; i++){
            System.out.println("继承Thread类子线程1: " + i);
        }
    }
}
class Method_Thread2 extends Thread{
    @Override
    public void run() {
        for (int i = 0; i < 10000; i++){
            System.out.println("继承Thread类子线程2: " + i);
        }
    }
}
class Method_Runnable1 implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 10000; i++){
            System.out.println("实现Runable接口子线程1: " + i);
        }
    }
}
class Method_Runnable2 implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 10000; i++){
            System.out.println("实现Runable接口子线程2: " + i);
        }
    }
}
class Main{
    public static void main(String[] args) {
        new Method_Thread1().start();
        new Method_Thread2().start();
        for (int i = 0; i < 10000; i++){
            System.out.println("主线程: " + i);
        }

        new Thread(new Method_Runnable1()).start();
        new Thread(new Method_Runnable2()).start();
        new Thread(() -> {
            for (int i = 0; i < 10000; i++) {
                System.out.println("实现Runable接口子线程3: " + i);
            }
        }).start();

    }
}

